<?xml version="1.0" encoding="UTF-8"?>
<!--
    Document      : $Id:lexs-library.xsd 85 2007-07-02 21:36:07Z $
    LEXS version  : 3.1.1
    Namespace     : xmlns:lexslib="http://usdoj.gov/leisp/lexs/library/3.1"
    Description   : a library for LEXS common elements.
-->
<xsd:schema 
    targetNamespace="http://usdoj.gov/leisp/lexs/library/3.1"
    version="3.1.1"
    xmlns:i="http://niem.gov/niem/appinfo/2.0"
    xmlns:s="http://niem.gov/niem/structures/2.0"
    xmlns:lexslib="http://usdoj.gov/leisp/lexs/library/3.1"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    
    <xsd:annotation>
        <xsd:documentation>LEXS Library for Common Elements and Digest</xsd:documentation>
        <xsd:appinfo>
            <i:ConformantIndicator>true</i:ConformantIndicator>
        </xsd:appinfo>
    </xsd:annotation>
    
    <xsd:import 
        namespace="http://niem.gov/niem/structures/2.0" 
        schemaLocation="../../niem-constrained/structures/2.0/structures.xsd"/>
    <xsd:import 
        namespace="http://niem.gov/niem/appinfo/2.0" 
        schemaLocation="../../niem-constrained/appinfo/2.0/appinfo.xsd"/>
    
    <xsd:complexType name="SameAsPayloadAssociationType">
        <xsd:annotation>
            <xsd:documentation>A structure that defines association that identifies objects as the same. Association is used to connect object in digest to object located within payload ( downpoint reference ).</xsd:documentation>
            <xsd:appinfo>
                <i:Base i:namespace="http://niem.gov/niem/structures/2.0" i:name="Object"/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="s:ComplexObjectType">
                <xsd:sequence>
                    <xsd:element ref="lexslib:ObjectReference"/>
                    <xsd:element ref="lexslib:PayloadObjectReference"/>
                    <xsd:element ref="lexslib:PayloadReference"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    
    <!-- used to point to the object located under PackageStructuredPayload when schema is not available -->
    <xsd:complexType name="ReferenceType" final="#all">
        <xsd:annotation>
            <xsd:documentation>A structure that allows reference to an object that is located within closed(xsd:any) container (for example under lexs:StructuredPayload) and is beyond the scope of XML Schema validation. lexslib:ref element holds a valid ID value for the scope of the referenced document (located under xsd:any) rather than a local document.</xsd:documentation>
        </xsd:annotation>
        <xsd:attribute ref="s:id"/>
        <xsd:attribute ref="lexslib:ref" use="required"/>
        <xsd:attribute ref="s:linkMetadata"/>
    </xsd:complexType>
    
    <xsd:element name="ObjectReference" type="s:ReferenceType">
        <xsd:annotation>
            <xsd:documentation>Reference to an object</xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    
    <xsd:element name="PayloadObjectReference" type="lexslib:ReferenceType">
        <xsd:annotation>
            <xsd:documentation>Reference to an object located within Payload. This reference is not validated by default with XML Schema validation during LEXS validation pass.</xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    
    <xsd:element name="PayloadReference" type="s:ReferenceType">
        <xsd:annotation>
            <xsd:documentation>Reference to a Payload</xsd:documentation>
            <xsd:appinfo>
                <i:AppliesTo i:name="PackageStructuredPayload" i:namespace="http://usdoj.gov/leisp/lexs/3.1"/>
            </xsd:appinfo>
        </xsd:annotation>
    </xsd:element>
    
    <!-- standalone form, used to connect entity from digest to payload ( downpoint reference ) -->
    <xsd:element name="SameAsPayloadAssociation" type="lexslib:SameAsPayloadAssociationType">
        <xsd:annotation>
            <xsd:documentation>Association that identifies objects as the same. Association is used to connect object in digest to object located within payload ( downpoint reference ).</xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    
    <!-- embedded form, single reference, used to point from payload entities to digest entities (uppoint reference )  -->
    <xsd:element name="SameAsDigestReference" type="lexslib:ReferenceType">
        <xsd:annotation>
            <xsd:documentation>Association that identifies objects as the same. Association is used to point from payload entity object to digest entity object ( uppoint reference ).</xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    
    <!-- reference to the object that is located beyond the scope of validation -->
    <xsd:attribute name="ref" type="xsd:NCName">
        <xsd:annotation>
            <xsd:documentation>Reference to an object. Used to point to an object that is located beyond the scope of XML Schema validation mechanisms.</xsd:documentation>
        </xsd:annotation>
    </xsd:attribute>
    
    
    
    <!--  Reference to the external Structured Payload object which is beyond the scope of validation from inside of Structured Payload -->
    <xsd:attribute name="pref" type="xsd:NCName">
        <xsd:annotation>
            <xsd:documentation>Reference to the external Structured Payload object which is beyond the scope of XML Schema validation mechanisms from inside of Structured Payload.</xsd:documentation>
        </xsd:annotation>
    </xsd:attribute>
    
    <!-- used to point to the object located under PackageStructuredPayload when schema is not available -->
    <xsd:complexType name="PayloadObjectReferenceType" final="#all">
        <xsd:annotation>
            <xsd:documentation>A structure that allows reference to an object that is located within closed(xsd:any) container (for example under lexs:StructuredPayload) and is beyond the scope of XML Schema validation. lexslib:ref element holds a valid ID value for the scope of the referenced document (located under xsd:any) rather than a local document.</xsd:documentation>
        </xsd:annotation>
        <xsd:attribute ref="s:id"/>
        <xsd:attribute ref="lexslib:ref" use="required"/>
        <xsd:attribute ref="lexslib:pref" use="required"/>
        <xsd:attribute ref="s:linkMetadata"/>
    </xsd:complexType>    
    
    <!-- embedded form, double reference, used to point from payload entities to other payload entities (cross reference ). Uses lexslib:ref to point to the object and lexlib:pref to point to structured payload  -->
    <xsd:element name="SameAsPayloadReference" type="lexslib:PayloadObjectReferenceType">
        <xsd:annotation>
            <xsd:documentation>Association that identifies objects as the same. Association is used to point from payload entity object to other payload entity object ( cross reference ).</xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    
</xsd:schema>
